package finobjects;

import java.util.ArrayList;

import constants.Period;

import managers.AccountManager;
import managers.TransactionManager;

public class Account {
	
	private String accountPrettyName;
	private int accountNumber;
	private double interest;
	private Period compoundingPeriod;
	
	public Account() {		
		//Guarantee new unique internal account number. Bit slow but should be hardly used.
		int i = 0;
		while(!(AccountManager.getAccountByNumber(i) == null)) {
			i++;
		}
		this.accountNumber = i;
		this.accountPrettyName = "NoNameGiven";
	}
	
	public Account(int number){
		this.accountNumber = number;
		this.accountPrettyName = "NoNameGiven";
	}
	
	public Account(int number, String name){
		this.accountNumber = number;
		this.accountPrettyName = name;
	}

	public int getAccountNumber() {
		return this.accountNumber;
	}
	
	public String getPrettyName() {
		return this.accountPrettyName;
	}
	
	public ArrayList<Transaction> getTransactionsInThisAccount() {
		return TransactionManager.getTransactionsByAccountNumber(this.accountNumber);
	}
	
}